#ifndef _uart_api_h
#define _uart_api_h

#define UART_RX_PIN_NUM              8
#define UART_TX_PIN_NUM              9
#define UART_PORT                    PIOA
#define UART_MCK                     84000000
#define UART_CLK_DIV                 16
#define UART_CLK_DIV_MIN_FACTOR      1
#define UART_CLK_DIV_MAX_FACTOR      65535

#define USART0_RX_PIN_NUM            10
#define USART0_TX_PIN_NUM            11
#define USART0_PORT                  PIOA

#define USART1_RX_PIN_NUM            12
#define USART1_TX_PIN_NUM            13
#define USART1_PORT                  PIOA


#define USART2_RX_PIN_NUM            21
#define USART2_TX_PIN_NUM            20
#define USART2_PORT                  PIOB


#define PARITY_TYPE_EVEN             0
#define PARITY_TYPE_ODD              1
#define PARITY_TYPE_SPACE            2
#define PARITY_TYPE_MARK             3
#define PARITY_TYPE_NO               4

#define CHANNEL_MODE_NORMAL          0
#define CHANNEL_MODE_AUTO            1
#define CHANNEL_MODE_LOCOL_LOOP      2
#define CHANNEL_MODE_REMOTE_LOOP     3


uint8_t UART_init(uint32_t baud_rate,uint32_t parity_type,uint32_t channel_mode,uint32_t sys_clk);
void UART_send_byte(uint8_t *send_buf,uint32_t count);
void UART_send_string(uint8_t *string);
uint8_t UART_receive_byte(void);

#endif
